package com.roc.web.action.windcontroll;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class TransLimitSearchCondition extends BaseSearchCondition {
	private String mchtCd;
	private String termId;
	private String orgCode;
	private String transType;
	private String riskInfo;
	private String cardType;
	private String flag;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(mchtCd))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_MCHT_CD", mchtCd,"LIKE", false,"ALL"));
		}
		if(Constance.isNotEmpty(termId))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_TERM_CD", termId,"=", false));
		}
		if(Constance.isNotEmpty(orgCode))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_INS_CD", orgCode,"=", false));
		}
		if(Constance.isNotEmpty(transType))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_TRANS_TYPE", transType,"=", false));
		}
		if(Constance.isNotEmpty(riskInfo))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_INFO_TYPE", riskInfo,"=", false));
		}
		if(Constance.isNotEmpty(cardType))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_KEY_TYPE", cardType,"=", false));
		}
		if(Constance.isNotEmpty(flag))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.RISK_USE", flag,"=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT COUNT(1) FROM APSTFR.TBL_MGM_RISK_RULE T WHERE T.RISK_KEY_TYPE NOT IN ('Banlance','Passwod') ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT T.RISK_INS_CD,T.RISK_MCHT_CD,T.RISK_TERM_CD,T.RISK_TRANS_TYPE,T.RISK_INFO_TYPE, "
				+ " T.RISK_NUM_CYCLE,T.RISK_KEY_TYPE,T.RISK_NUM_TYPE,T.RISK_NUM_UNITE,T.RISK_NUM_VAULE, "
				+ " T.RISK_USE FROM APSTFR.TBL_MGM_RISK_RULE T WHERE T.RISK_KEY_TYPE NOT IN ('Banlance','Passwod') ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		
		return " ORDER BY  T.RISK_INS_CD,T.RISK_MCHT_CD,T.RISK_USE DESC ";
	}

	public String getMchtCd() {
		return mchtCd;
	}

	public void setMchtCd(String mchtCd) {
		this.mchtCd = mchtCd;
	}

	public String getTermId() {
		return termId;
	}

	public void setTermId(String termId) {
		this.termId = termId;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public String getTransType() {
		return transType;
	}

	public void setTransType(String transType) {
		this.transType = transType;
	}

	public String getRiskInfo() {
		return riskInfo;
	}

	public void setRiskInfo(String riskInfo) {
		this.riskInfo = riskInfo;
	}

	public String getCardType() {
		return cardType;
	}

	public void setCardType(String cardType) {
		this.cardType = cardType;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}
		
}
